package github.kawaiior.yuanchuxiuzhen.core.init;

import github.kawaiior.yuanchuxiuzhen.common.gongfa.*;
import github.kawaiior.yuanchuxiuzhen.common.gongfa.base.*;
import github.kawaiior.yuanchuxiuzhen.common.gongfa.pre.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class GongFaInit {

    /**
     * 金: MP回复
     * 木: 最大HP
     * 水: 最大MP
     * 火: 攻击
     * 土: 防御
     */

    public static final ArrayList<IGongFa> GONG_FAS = new ArrayList<>();
    public static final Map<IGongFa, Integer> GONG_FA_MAP = new HashMap<>();

    // 功法
    public static final IGongFa EMPTY_GONG_FA = new EmptyGongFa();
    public static final IGongFa JIN_YAO_JUE = new JinYaoJue("jin_yao_jue_item");
    public static final IGongFa QING_MU_JUE = new QingMuJue("qing_mu_jue_item");
    public static final IGongFa XUAN_SHUI_JUE = new XuanShuiJue("xuan_shui_jue_item");
    public static final IGongFa CHI_YAN_JUE = new ChiYanJue("chi_yan_jue_item");
    public static final IGongFa YAN_TU_JUE = new YanTuJue("yan_tu_jue_item");

    public static final IGongFa JIN_GUANG_XUAN_GONG = new JinGuangXuanGong("jin_guang_xuan_gong");
    public static final IGongFa BAI_CAO_ZHEN_JING = new BaiCaoZhenJing("bai_cao_zhen_jing");
    public static final IGongFa YOU_SHUI_ZHEN_JING = new YouShuiZhenJing("you_shui_zhen_jing");
    public static final IGongFa FEN_JIN_CHI_HUO_JUE = new FenJinChiHuoJue("fen_jin_chi_huo_jue");
    public static final IGongFa QING_SHAN_ZHEN_DI_GONG = new QingShanZhenDiGong("qing_shan_zhen_di_gong");

    static {
        // 给功法添加映射
        GONG_FAS.add(EMPTY_GONG_FA);

        GONG_FAS.add(JIN_YAO_JUE);
        GONG_FAS.add(QING_MU_JUE);
        GONG_FAS.add(XUAN_SHUI_JUE);
        GONG_FAS.add(CHI_YAN_JUE);
        GONG_FAS.add(YAN_TU_JUE);

        GONG_FAS.add(JIN_GUANG_XUAN_GONG);
        GONG_FAS.add(BAI_CAO_ZHEN_JING);
        GONG_FAS.add(YOU_SHUI_ZHEN_JING);
        GONG_FAS.add(FEN_JIN_CHI_HUO_JUE);
        GONG_FAS.add(QING_SHAN_ZHEN_DI_GONG);
    }

    static {
        for (int i = 0; i < GONG_FAS.size(); i++) {
            GONG_FA_MAP.put(GONG_FAS.get(i), i);
        }
    }

    public static IGongFa getGongFa(int index){
        return GONG_FAS.get(index);
    }

    public static int getGongFaIndex(IGongFa gongFa){
        return GONG_FA_MAP.get(gongFa);
    }
}
